package com.yu.hu.feature.main

import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import com.yu.hu.base.ui.theme.LiteAppScaffoldTheme
import com.yu.hu.feature.BuildConfig

/**
 * huyu create
 * 2025/11/4 9:18
 */
@Composable
internal fun MainScreen(
    onDebugClick: () -> Unit
) {
    Scaffold(
        modifier = Modifier.fillMaxSize(),
        floatingActionButton = {
            if (BuildConfig.DEBUG) {
                FloatingActionButton(
                    onClick = onDebugClick
                ) {
                    Text("debug")
                }
            }
        },
        containerColor = Color.Red,
        contentColor = Color.White
    ) { paddingValues ->
        Greeting(
            name = "Android",
            modifier = Modifier
                .fillMaxSize()
                .padding(paddingValues)
        )
    }
}

@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
    Text(
        text = "Hello $name!",
        modifier = modifier
    )
}

@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
    LiteAppScaffoldTheme {
        Greeting(
            name = "Android",
            modifier = Modifier.fillMaxSize()
        )
    }
}